package com.wsj.message_server.controller;

import com.wsj.message_server.service.PushAppService;
import com.wsj.message_server.utils.IMUtils;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

@RestController
@RequestMapping("/api/system/push")
public class PushAppController {

    @Autowired
    private PushAppService  service;

    @GetMapping("androidApp")
    public String androidApp(@RequestParam(value = "title") String title,
                      @RequestParam(value = "content") String content,
                      @RequestParam(value = "token") String token,
                      @RequestParam(value = "type")String type) {
        return service.androidApp(title, content, token,type);
    }

    @GetMapping("iosApp")
    public String iosApp(@RequestParam(value = "title") String title,
                             @RequestParam(value = "content") String content,
                             @RequestParam(value = "token") String token,
                             @RequestParam(value = "type")String type) {
        return service.iosApp(title, content, token,type);
    }

    @GetMapping("androidAppList")
    public String androidAppList(@RequestParam(value = "title") String title,
                                 @RequestParam(value = "content") String content,
                                 @RequestParam(value = "token") List<String> token,
                                 @RequestParam(value = "type") String type,
                                 @RequestParam(value = "materialId") long materialId,
                                 @RequestParam(value = "typeId") int typeId,
                                 @RequestParam(value = "poster") long poster) {
        return service.androidAppList(title, content, token, type,materialId,typeId,poster);
    }

    @GetMapping("iosAppList")
    public String iosAppList(@RequestParam(value = "title") String title,
                             @RequestParam(value = "content") String content,
                             @RequestParam(value = "token") List<String> token,
                             @RequestParam(value = "type") String type,
                             @RequestParam(value = "materialId") long materialId,
                             @RequestParam(value = "typeId") int typeId,
                             @RequestParam(value = "poster") long poster) {
        return service.iosAppList(title, content, token, type,materialId,typeId,poster);
    }
}
